﻿using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using DeGiglio.biz.Twitter.Classes;
using DeGiglio.biz.Twitter.Properties;
using controls = DeGiglio.biz.Twitter.UserControls;

namespace DeGiglio.biz.Twitter.SharePoint.Webparts
{
    [ToolboxItemAttribute(false)]
    public class GetRateLimit : WebPart
    {
        #region " Twitter Properties "
        #region TwitterConsumerKey
        [WebBrowsable(true),
         CategoryLocalized("WPPropertyCategory_TwitterConfig"),
         Personalizable(PersonalizationScope.Shared),
         WebDisplayNameLocalized("WPPropertyName_ConsumerKey"),
         DescriptionLocalized("WPPropertyDescription_ConsumerKey")]
        public string TwitterConsumerKey { get; set; }
        #endregion

        #region TwitterConsumerSecret
        [WebBrowsable(true),
         CategoryLocalized("WPPropertyCategory_TwitterConfig"),
         Personalizable(PersonalizationScope.Shared),
         WebDisplayNameLocalized("WPPropertyName_ConsumerSecret"),
         DescriptionLocalized("WPPropertyDescription_ConsumerSecret")]
        public string TwitterConsumerSecret { get; set; }
        #endregion
        #endregion

        protected override void CreateChildControls()
        {
            controls.GetRateLimit control = Page.LoadControl(ProjectSettings.Default.ControlPath_GetRateLimit) as controls.GetRateLimit;

            if (control != null)
            {
                control.GetRateLimitWebPart = this;
                this.Controls.Add(control);
            }
        }
    }
}
